Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
How to manipulate and access nested json data file with "beforedatavalidated" option in amCharts?

I tried to manipulate with the option "beforedatavalidated" this json data:

      [("air":{
            "indicateur": 4
            },
      "date": "2021-09-10"

       },{
      "air":{
            "indicateur": 3
            },
      "date": "2021-09-11"

      },{
      "air":{
            "indicateur": 1
            },
      "date": "2021-09-12"

      },{
      "air":{
            "indicateur": 1
            },
      "date": "2021-09-08"

    }]

Here is a part of the configuration of the charts:

// Create axes
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "date";
categoryAxis.renderer.grid.template.location = 0;
categoryAxis.renderer.minGridDistance = 150;
categoryAxis.tooltip.disabled = "visible";

categoryAxis.renderer.labels.template.adapter.add("dy", function(dy, target) {
  if (target.dataItem && target.dataItem.index & 2 == 2) {
    return dy + 0;
  }
  return dy;
})

var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.renderer.minWidth = 50;
valueAxis.min = 0;
valueAxis.cursorTooltipEnabled = false;

// Create series
var series = chart.series.push(new am4charts.ColumnSeries());
series.sequencedInterpolation = "visible";
//series.data.value = air;
series.dataFields.valueY = "air";
series.dataFields.categoryX = "date";
series.tooltipText = "[{categoryX}: bold]{valueY}[/]";
series.columns.template.strokeWidth = 0;
series.columns.template.column.cornerRadiusTopLeft = 10;
series.columns.template.column.cornerRadiusTopRight = 10;
//series.fill = am4core.color("#50f0e6");





series.data.events.on("beforedatavalidated", function(ev){
  var source = ev.target.chart.data;
    if (source.air) {
      ev.target.chart.data = source.air.indicateur;

      }   
    });

I tried to access "indicateur" value but fail at all. I tried to look all over amcharts documentation and could not still understand how to do it in this situation.

Big thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!